﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using TelemetryCommon;
using TestClient.TelemetryServiceReference;

namespace TestClient
{
    class Program
    {
        static void Main(string[] args)
        {
            Snapshot.DiscoverProxy();

            Snapshot.Generate(
                new Sensor(SensorType.ModuleName, "Main"),
                new Sensor(SensorType.ActionGroupName, "Server Web Method"),
                new Sensor(SensorType.Action, "EnterMethod"));
/*
            MarkerClient client = new MarkerClient("NetTcpBinding_IMarker");
            client.InitiateSession();

            MarkerStamp data = new MarkerStamp();
            data.ActionGroupName = "With Data contract";
            data.ModuleName = CreateRandomString(10);

            string s = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
            data.Timestamp = s;
 
            client.GenerateSnapshotAsync(data);
*/
            Console.WriteLine("Press <enter> to finish...");
            Console.ReadLine();
        }

        public static string CreateRandomString(int length)
        {
            const string charPool = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";

            var rs = new StringBuilder();

            for (int i = 0; i < length; i++)
            {
                rs.Append(charPool[new Random().Next(charPool.Length)]);
            }

            return rs.ToString();
        }
    }
}

